package alert
import (
"github.com/K-Phoen/grabana/alert/queries/graphite"
"github.com/K-Phoen/grabana/alert/queries/influxdb"
"github.com/K-Phoen/grabana/alert/queries/loki"
"github.com/K-Phoen/grabana/alert/queries/prometheus"
"github.com/K-Phoen/grabana/alert/queries/stackdriver"
)
func WithPrometheusQuery (ref string , query string , options ...prometheus .Option ) Option {
return func (alert *Alert ) {
target := prometheus .New (ref , query , options ...)
alert .Builder .Rules [0 ].GrafanaAlert .Data = append (alert .Builder .Rules [0 ].GrafanaAlert .Data , target .Builder )
}
}
func WithGraphiteQuery (ref string , query string , options ...graphite .Option ) Option {
return func (alert *Alert ) {
target := graphite .New (ref , query , options ...)
alert .Builder .Rules [0 ].GrafanaAlert .Data = append (alert .Builder .Rules [0 ].GrafanaAlert .Data , target .Builder )
}
}
func WithLokiQuery (ref string , query string , options ...loki .Option ) Option {
return func (alert *Alert ) {
target := loki .New (ref , query , options ...)
alert .Builder .Rules [0 ].GrafanaAlert .Data = append (alert .Builder .Rules [0 ].GrafanaAlert .Data , target .Builder )
}
}
func WithStackdriverQuery (query *stackdriver .Stackdriver ) Option {
return func (alert *Alert ) {
alert .Builder .Rules [0 ].GrafanaAlert .Data = append (alert .Builder .Rules [0 ].GrafanaAlert .Data , query .Builder )
}
}
func WithInfluxDBQuery (ref string , query string , options ...influxdb .Option ) Option {
return func (alert *Alert ) {
target := influxdb .New (ref , query , options ...)
alert .Builder .Rules [0 ].GrafanaAlert .Data = append (alert .Builder .Rules [0 ].GrafanaAlert .Data , target .Builder )
}
}
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .